#ifndef __SKIPLIST_HEADER__
#define __SKIPLIST_HEADER__
#define ZSKIPLIST_MAXLEVEL 64

typedef char *sds;

typedef struct zskiplistNode
{
    sds ele;
    double score;
    struct zskiplistNode *backward;
    struct zskiplistLevel
    {
        struct zskiplistNode *forward;
        unsigned long span;
    } level[];
} zskiplistNode;

typedef struct zskiplist
{
    struct zskiplistNode *header, *tail;
    int level;
    unsigned long length;
} zskiplist;

zskiplistNode *zslInsert(zskiplist *zsl, double score, sds ele);

#endif